Laravel deployment
Project Extraction
-
First you have to extract the
snapta.zip
then you will get three zip files.- snapta_laravel.zip
- snapta_admin.zip
- snapta_node.zip
- snapta_web.zip (if you have website version)
- snapta_app.zip (if you have application version)
-
Create
snapta_laravel
folder with below commandmkdir -p /var/www/snapta_laravel
-
Upload
snapta_laravel.zip
to a location where you want to deploy Project using FileZilla/var/www/snapta_laravel
(This is the recommended location)
-
Change ownership of the folder to current user
chown -R www-data:www-data /var/www/snapta_laravel
-
Install unzip to
unzip
the Project . Run following command to install unzipsudo apt install unzip
-
extract the
snapta_laravel.zip
unzip snapta_laravel.zip
Configurations
- After the extraction you will see the Project files
Configure Environment Variables
-
Edit the
.env
file in the root directory of your project. This step is mandatory to ensure the application can connect to your database. -
Update the following lines in the
.env
file with your actual server and database credentials:APP_URL=http://{your_server_ip}
DB_DATABASE={your_database_name}
DB_USERNAME={your_database_username}
DB_PASSWORD={your_database_password}
Clear Configuration Caches
-
Before running migrations, clear all cached configurations using the following Artisan commands:
php artisan config:clear
php artisan cache:clear
php artisan route:clear
php artisan view:clear
php artisan optimize
Install Laravel Passport
- Passport is required for API authentication. Install it by running:
php artisan passport:install --force
- During the installation process, you may be prompted with configuration options. Answer "yes" to all questions.
Server Starting
To Serve our project you have to edit apache virtualhost file.
- Open default virtualhost file.
sudo nano /etc/apache2/sites-available/000-default.conf
- Replace existing Directory and DocumentRoot with below ones.
ServerAdmin webmaster@localhost
ServerName 217.196.51.119
DocumentRoot /var/www/snapta_laravel/public
<Directory /var/www/snapta_laravel/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
-
then after enable rewrite module of apache
a2enmod rewrite
- First check for any syntax error with below command.
apachectl configtest
- If syntax is ok then after restart the server.
sudo systemctl restart apache2
Varification
Open below url in the web browser.
http://{your_server_ip}/SoftwareInstallation1
-
If everything was installed correctly then you will see page like below.
-
Requirements PHP Extensions.
-
In here you have to enter envato
Username
andpurchase code
.Purchase codeYou can only use this purchase code one time.
-
Third steps is for database configuration.
-
Provide a Database name which you want to use for this snapta (That Database must not be exist before creation. That will be automatically created at runtime)
-
Provide Database Username (User which will have acces of this Database. For Security purpose Provide a totally new username for this )
-
Provide Database User's Password. This password will be used to access that database. Although Root user will have access of all the Databse which exist in It's MySQL
-
After all the installation prccess completed you will see this page.
noteAfter successfully completing the manual deployment, please run
php artisan optimize
in your project. This step is mandatory. Additionally, if you make any changes to the .env file, always remember to runphp artisan optimize
afterward.
-